package com.example.wjy.viewmodels;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.example.room.entity.PublicTeam;
import com.example.room.repository.PublicTeamRepository;

import java.util.List;

public class PublicTeamViewModel extends AndroidViewModel {

    PublicTeamRepository repository;

    public PublicTeamViewModel(@NonNull Application application) {
        super(application);
        repository = new PublicTeamRepository(application.getApplicationContext());
    }

    public void insertTeam(PublicTeam... publicTeams) {
        repository.insertTeam(publicTeams);
    }

    public LiveData<List<PublicTeam>> getAllTeams() {
        return repository.getAllTeams();
    }

    public void deleteTeam() {
        repository.deleteAllTeam();
    }
}
